#include "stdafx.h"
#include "MoveHistory.h"


CMoveHistory::CMoveHistory()
{
}


CMoveHistory::~CMoveHistory()
{
}

uint CMoveHistory::Reset()
{ 
    ply = 0; 
    return 0; 
};

uint CMoveHistory::AddMove( uint m, uint64 h )
{
    move[ ply ] = m;
    hash[ ply ] = h;
    ply++;
    return 0;
}

uint CMoveHistory::Undo()
{
    if (ply) ply--;
    return 0;
}

uint CMoveHistory::IsDraw( uint64 my_hash )
{
    if ( ( ( ply >= 4 ) && ( hash[ply-4] == my_hash ) ) ||
         ( ( ply >= 6 ) && ( hash[ply-6] == my_hash ) ) ||
         ( ( ply >= 8 ) && ( hash[ply-8] == my_hash ) ) ) return 1;    
    else return 0;
}